<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<html>
<head>
<script type="text/javascript">
	
</script>

<script type="text/javascript">

var listPageUrl = "device/index.do";

	//将数据保存到数据库中
	function saveDevice() {
		$('#device-add-fm').submit();  
	}
	
	$("#device-add-fm").form({
		url:'device/save.do',    
	    onSubmit: function(){    
	    	return $("#device-add-fm").form("validate");
	    },
		success:function(data){
			back(listPageUrl);
		}
	});
	$("#device_add_type").combobox({
		editable : false,
		width : 300,
		panelHeight : 170,
		valueField : 'value',
		textField : 'label',
		data : [ {
			label : '主机',
			value : '1',
			selected : true
		}, {
			label : '手机',
			value : '2'
		}, {
			label : '笔记本',
			value : '3'
		}, {
			label : '打印机',
			value : '4'
		}, {
			label : '空调',
			value : '5'
		} ]
	})
	/**
	 * 返回页面
	 */
	function back(url) {
		$.get(url, {}, function(data) {
			$("#center").empty();
			$("#center").html(data);
			$.parser.parse($("#center"));
		});
	}
</script>
</head>
<body>

	<div class="linkbar">
		<a> 设备管理</a>/<a> 信息录入</a>
	</div>
	<div id="device-add" buttons="#vehicle-add-buttons">
		<form id="device-add-fm" method="post" novalidate="true">
			<div class="fitem">
				<label>名称:</label> <input name="name" class="easyui-validatebox"
					missingMessage="该输入项不能为空！" required="required"
					placeholder="例如  : XY- xxx" /> <span style="display: none"
					id="massage">请输入设备编号!!!</span>
			</div>
			<div class="fitem">
				<label>类型:</label> <input name="type" id="device_add_type"
					missingMessage="该输入项不能为空！" required="required" /> <span
					style="display: none" id="massage1">请选择类型!!!</span>
			</div>
			<div class="fitem">
				<label>价格(万元):</label> <input name="price" class="easyui-numberbox"
					missingMessage="该输入项不能为空！" required="required"
					style="width: 300px; height: 30px" data-options="min:0,precision:2" />
				<span style="display: none" id="massage2">请输入价格!!!</span>
			</div>
			<div class="fitem">
				<label>CPU(核心数):</label> <input name="cpu"
					class="easyui-validatebox" missingMessage="该输入项不能为空！"
					required="required" /> <span style="display: none" id="massage3">请输入核心数!!!</span>
			</div>
			<div class="fitem">
				<label>内存(GB):</label> <input name="mem" class="easyui-validatebox"
					missingMessage="该输入项不能为空！" required="required" /> <span
					style="display: none" id="massage4">请输入内存!!!</span>
			</div>
			<div class="fitem">
				<label>租用开始日期:</label> <input name="borrowBeginDay"
					class="easyui-datebox" missingMessage="该输入项不能为空！" required="true"
					style="width: 300px; height: 30px" id="borrowBeginDay" /> <span
					style="display: none" id="massage4">请输入开始日期!!!</span>
			</div>
			<div class="fitem">
				<label>租用结束日期:</label> <input name="borrowEndDay"
					class="easyui-datebox" missingMessage="该输入项不能为空！" required="true"
					style="width: 300px; height: 30px"
					validType="equaldDate['#borrowBeginDay']" /> <span
					style="display: none" id="massage4">请输入结束日期!!!</span>
			</div>
		</form>
	</div>
	<div id="dlg-buttons">
		<a href="#" class="easyui-linkbutton" iconCls="icon-ok"
			onclick="saveDevice()">保存</a> <a href="#" class="easyui-linkbutton"
			iconCls="icon-cancel" onclick="back('device/index.do')">返回</a>
	</div>


</body>
</html>
</html>